8 function isInt(d : double) : boolean;
\r
10 isInt := (floor(d) = d);
\r
13 procedure miStringReplace(var s : string; old : char; new : char);
\r
18 for i := 0 to length(s) do
\r
26 procedure printFloat(d : double);
\r
28 ReplaceFlags : TReplaceFlags;
\r
31 s := format('$%f', [d]);
\r
32 miStringReplace(s, ',', '.');
\r
34 //writeln(StringReplace(format('$%f', [d]), ',', '.'));
\r
35 //writeln(StringReplace(format('$%f', [d]), ',', '.' ReplaceFlags));
\r
36 //writeln(StringReplace(formatFloat('$#0.00', d), ',', '.', ReplaceFlags));
\r
40 s : Array[0..1001] of double;
\r
42 promedio, mas, menos : double;
\r
44 ReplaceFlags : TReplaceFlags;
\r
47 //reset(input, 'inside.txt');
\r
48 //reset(output, 'outside.txt');
\r
58 promedio := promedio + s[i];
\r
60 promedio := promedio / n;
\r
61 if (isInt(promedio * 100)) then
\r
66 promedio := floor(promedio * 100) / 100;
\r
68 //printFloat(promedio); writeLn('(Redondeado hacia abajo)');
\r
71 if s[i] < promedio then
\r
72 menos := menos + abs(s[i] - promedio)
\r
74 if s[i] > promedio then
\r
77 mas := mas + abs(s[i] - (promedio + 0.01))
\r
79 mas := mas + abs(s[i] - promedio);
\r